{% extends "blog/base.html" %}
{% block content %}
<h3>添加新文章</h3>
<form method="POST" class="form-horizontal" role="form" action="" >
  {% csrf_token %}

  {% for hidden_field in form.hidden_fields %}
    {{ hidden_field }}
  {% endfor %}

  {% if form.non_field_errors %}
    <div class="alert alert-danger col-md-12" role="alert">
      {% for error in form.non_field_errors %}
        {{ error }}
      {% endfor %}
    </div>
  {% endif %}

  {% for field in form.visible_fields %}
  <div class="form-group col-md-12">
        {{ field.label_tag }}
        {{ field }}
        {% if field.errors %}
          {% for error in field.errors %}
            <div class="invalid-feedback">
              {{ error }}
            </div>
          {% endfor %}
        {% endif %}
      {% if field.help_text %}
        <small class="form-text text-muted">{{ field.help_text }}</small>

      {% endif %}
    </div>
  {% endfor %}
  <div class="form-group">
     <div class="col-md-12">
    <input type="submit" class="btn btn-primary form-control" value="提交">
     </div>
  </div>
</form>

{% endblock %}